# Contributor: Fabricio Silva <hi@fabricio.dev>
# Maintainer: Fabricio Silva <hi@fabricio.dev>
pkgname=py3-bencode
_pkgname=bencode.py
pkgver=4.0.0
pkgrel=1
pkgdesc="Simple bencode parser"
url="https://github.com/fuzeman/bencode.py"
arch="noarch"
license="BitTorrent-1.1"
makedepends="
	py3-setuptools
	py3-pbr
	py3-gpep517
	py3-wheel
	"
checkdepends="py3-pytest"
source="$pkgname-$pkgver.tar.gz::https://github.com/fuzeman/bencode.py/archive/$pkgver.tar.gz"
subpackages="$pkgname-pyc"
builddir="$srcdir"/$_pkgname-$pkgver

build() {
	export PBR_VERSION=$pkgver
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
30d6e9c61fbe91d274b10e9a8bd01cee77111e164a41975433a3a6d9d225a3148887fbb46153c6800f1a0846c8dd1e9852d4d4bed67a1964aac7bdb6837e6072  py3-bencode-4.0.0.tar.gz
"
